同時支援Nvidia以及AMD的GPU
sudo apt update
sudo apt install nvtop
FROM nvidia/cuda
RUN apt-get update && \
apt-get install -y cmake libncurses5-dev libncursesw5-dev git && \
rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/stubs/libnvidia-ml.so /usr/local/lib/libnvidia-ml.so && \
ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/stubs/libnvidia-ml.so /usr/local/lib/libnvidia-ml.so.1 && \
cd /tmp && \
git clone https://github.com/Syllo/nvtop.git && \
mkdir -p nvtop/build && cd nvtop/build && \
cmake .. && \
make && \
make install && \
cd / && \
rm -r /tmp/nvtop && \
rm /usr/local/lib/libnvidia-ml.so && \
rm /usr/local/lib/libnvidia-ml.so.1
ENTRYPOINT ["/usr/local/bin/nvtop"]
這裡cuda用的是10.2可能得視自身情況修改 (ex: RTX30不支援)
或是可以參考nvtop repo內的Dockerfile
有可能是清單內沒有可以下載的網址,比較常發生在debian,可以去source list設定non-free
sudo vim /etc/apt/sources.list
在每行的結尾加上空格與non-free (這個做法不適用於Ubuntu)
有些OS並沒有提供已經編譯好的套件供安裝,這裡就得自己compile了
撰寫文章時只支援Ubuntu 20.04/ 20.10,而18.04已經裝不了
先裝必要的套件
sudo apt install cmake libncurses5-dev libncursesw5-dev git
git clone https://github.com/Syllo/nvtop.git
mkdir -p nvtop/build && cd nvtop/build
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON
make
# Install globally on the system
sudo make install
# Alternatively, install without privileges at a location of your choosing
# make DESTDIR="/your/install/path" install
GitHub - Syllo/nvtop: AMD and NVIDIA GPUs htop like monitoring tool
Wrap NVTOP in docker (Impossible to initialize nvidia nvml) · Issue #42 · Syllo/nvtop
nvtop not found in Debian Buster repositories · Issue #46 · Syllo/nvtop